import 'package:mziot/app/data/scene_info_entity.dart';
import 'package:mziot/generated/json/base/json_convert_content.dart';

SceneInfoEntity $SceneInfoEntityFromJson(Map<String, dynamic> json) {
  final SceneInfoEntity sceneInfoEntity = SceneInfoEntity();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    sceneInfoEntity.id = id;
  }
  final String? sceneName = jsonConvert.convert<String>(json['sceneName']);
  if (sceneName != null) {
    sceneInfoEntity.sceneName = sceneName;
  }
  final String? remark = jsonConvert.convert<String>(json['remark']);
  if (remark != null) {
    sceneInfoEntity.remark = remark;
  }
  final String? sceneBackImg = jsonConvert.convert<String>(json['sceneBackImg']);
  if (sceneBackImg != null) {
    sceneInfoEntity.sceneBackImg = sceneBackImg;
  }
  final String? sceneStartTime = jsonConvert.convert<String>(json['sceneStartTime']);
  if (sceneStartTime != null) {
    sceneInfoEntity.sceneStartTime = sceneStartTime;
  }
  final String? sceneEndTime = jsonConvert.convert<String>(json['sceneEndTime']);
  if (sceneEndTime != null) {
    sceneInfoEntity.sceneEndTime = sceneEndTime;
  }
  final bool? sceneSwitch = jsonConvert.convert<bool>(json['sceneSwitch']);
  if (sceneSwitch != null) {
    sceneInfoEntity.sceneSwitch = sceneSwitch;
  }
  final bool? lockStatus = jsonConvert.convert<bool>(json['lockStatus']);
  if (lockStatus != null) {
    sceneInfoEntity.lockStatus = lockStatus;
  }
  final String? timezoneCode = jsonConvert.convert<String>(json['timezoneCode']);
  if (timezoneCode != null) {
    sceneInfoEntity.timezoneCode = timezoneCode;
  }
  final List<int>? groupIds = jsonConvert.convertListNotNull<int>(json['groupIds']);
  if (groupIds != null) {
    sceneInfoEntity.groupIds = groupIds;
  }
  final List<String>? groupNames = jsonConvert.convertListNotNull<String>(json['groupNames']);
  if (groupNames != null) {
    sceneInfoEntity.groupNames = groupNames;
  }
  final int? lightRate = jsonConvert.convert<int>(json['lightRate']);
  if (lightRate != null) {
    sceneInfoEntity.lightRate = lightRate;
  }
  final List<SceneInfoMomentVo>? momentVo =
      jsonConvert.convertListNotNull<SceneInfoMomentVo>(json['momentVo']);
  if (momentVo != null) {
    sceneInfoEntity.momentVo = momentVo;
  }
  return sceneInfoEntity;
}

Map<String, dynamic> $SceneInfoEntityToJson(SceneInfoEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['sceneName'] = entity.sceneName;
  data['sceneBackImg'] = entity.sceneBackImg;
  data['sceneStartTime'] = entity.sceneStartTime;
  data['sceneEndTime'] = entity.sceneEndTime;
  data['sceneSwitch'] = entity.sceneSwitch;
  data['lockStatus'] = entity.lockStatus;
  data['timezoneCode'] = entity.timezoneCode;
  data['groupIds'] = entity.groupIds;
  data['groupNames'] = entity.groupNames;
  data['lightRate'] = entity.lightRate;
  data['remark'] = entity.remark;
  data['momentVo'] = entity.momentVo?.map((v) => v.toJson()).toList();
  return data;
}

SceneInfoMomentVo $SceneInfoMomentVoFromJson(Map<String, dynamic> json) {
  final SceneInfoMomentVo sceneInfoMomentVo = SceneInfoMomentVo();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    sceneInfoMomentVo.id = id;
  }
  final String? start = jsonConvert.convert<String>(json['start']);
  if (start != null) {
    sceneInfoMomentVo.start = start;
  }
  final int? startHour = jsonConvert.convert<int>(json['startHour']);
  if (startHour != null) {
    sceneInfoMomentVo.startHour = startHour;
  }
  final int? startMinute = jsonConvert.convert<int>(json['startMinute']);
  if (startMinute != null) {
    sceneInfoMomentVo.startMinute = startMinute;
  }
  final String? end = jsonConvert.convert<String>(json['end']);
  if (end != null) {
    sceneInfoMomentVo.end = end;
  }
  final int? endHour = jsonConvert.convert<int>(json['endHour']);
  if (endHour != null) {
    sceneInfoMomentVo.endHour = endHour;
  }
  final int? endMinute = jsonConvert.convert<int>(json['endMinute']);
  if (endMinute != null) {
    sceneInfoMomentVo.endMinute = endMinute;
  }
  final int? lightRate = jsonConvert.convert<int>(json['lightRate']);
  if (endMinute != null) {
    sceneInfoMomentVo.lightRate = lightRate;
  }
  return sceneInfoMomentVo;
}

Map<String, dynamic> $SceneInfoMomentVoToJson(SceneInfoMomentVo entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['start'] = entity.start;
  data['startHour'] = entity.startHour;
  data['startMinute'] = entity.startMinute;
  data['end'] = entity.end;
  data['endHour'] = entity.endHour;
  data['endMinute'] = entity.endMinute;
  data['lightRate'] = entity.lightRate;
  return data;
}
